# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=pg_activity
pkgver=3.5.1
pkgrel=0
pkgdesc="Top like application for PostgreSQL server activity monitoring"
url="https://github.com/dalibo/pg_activity"
arch="noarch"
license="PostgreSQL"
depends="
	py3-attrs
	py3-blessed
	py3-humanize
	py3-psutil
	py3-psycopg2
	python3
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-psycopg
	py3-pytest
	"
provides="py3-pg_activity=$pkgver-r$pkgrel"
subpackages="$pkgname-pyc"
source="https://github.com/dalibo/pg_activity/archive/v$pkgver/pg_activity-$pkgver.tar.gz"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -p no:warnings \
		--ignore=tests/test_ui.txt \
		--ignore=tests/test_data.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
f44f1ca08a250e35c056441f11c19e3618fba82a36f367df211ceb5787983ff76d2637a155de80c998680f9c0f79d66fcb38873d1b04368e73b5a06e650789c5  pg_activity-3.5.1.tar.gz
"
